how to install CDH6.2 on centos7

  1. set hostname

    hostnamectl set-hostname h1
    hostnamectl set-hostname h2
    hostnamectl set-hostname h3
    
  2. set hosts

    192.168.1.1 h1
    192.168.1.2 h2
    192.168.1.3 h3
    
  3. disable selinux and firewalld

    sed -i 's/^SELINUX=.*$/SELINUX=disabled/g' /etc/selinux/config
    setenforce 0
    systemctl stop firewalld
    systemctl disable firewalld
    
  4. add crontab

    yum install rdate pssh -y
    pssh -h host.txt -l root -i -O StrictHostKeyChecking=no -A sh -c 'crontab -l |(cat;echo "*/5 * * * * /usr/bin/rdate -s time.nist.gov")| crontab -'
    
  5. download repo file

    curl -o /etc/yum.repos.d/cloudera-manager.repo https://archive.cloudera.com/cm6/6.2.0/redhat7/yum/cloudera-manager.repo
    rpm --import https://archive.cloudera.com/cm6/6.2.0/redhat7/yum/RPM-GPG-KEY-cloudera
    
  6. install jdk

    yum install oracle-j2sdk1.8 -y
    
  7. install cm

    yum install cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server -y
    
  8. install mysql5.6

    yum install http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm -y
    yum install mysql-server -y
    
    cat << EOF > /etc/my.cnf
    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    transaction-isolation = READ-COMMITTED
    # Disabling symbolic-links is recommended to prevent assorted security risks;
    # to do so, uncomment this line:
    symbolic-links = 0
    
    key_buffer_size = 32M
    max_allowed_packet = 32M
    thread_stack = 256K
    thread_cache_size = 64
    query_cache_limit = 8M
    query_cache_size = 64M
    query_cache_type = 1
    
    max_connections = 550
    #expire_logs_days = 10
    #max_binlog_size = 100M
    
    #log_bin should be on a disk with enough free space.
    #Replace '/var/lib/mysql/mysql_binary_log' with an appropriate path for your
    #system and chown the specified folder to the mysql user.
    log_bin=/var/lib/mysql/mysql_binary_log
    
    #In later versions of MySQL, if you enable the binary log and do not set
    #a server_id, MySQL will not start. The server_id must be unique within
    #the replicating group.
    server_id=1
    
    binlog_format = mixed
    
    read_buffer_size = 2M
    read_rnd_buffer_size = 16M
    sort_buffer_size = 8M
    join_buffer_size = 8M
    
    # InnoDB settings
    innodb_file_per_table = 1
    innodb_flush_log_at_trx_commit  = 2
    innodb_log_buffer_size = 64M
    innodb_buffer_pool_size = 4G
    innodb_thread_concurrency = 8
    innodb_flush_method = O_DIRECT
    innodb_log_file_size = 512M
    
    [mysqld_safe]
    log-error=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid
    
    sql_mode=STRICT_ALL_TABLES
    EOF
    
    systemctl enable mysqld
    systemctl start mysqld
    /usr/bin/mysql_secure_installation
    
  9. install mysql jdbc driver

    wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.46.tar.gz
    tar zxvf mysql-connector-java-5.1.46.tar.gz
    mkdir -p /usr/share/java/
    cd mysql-connector-java-5.1.46
    cp mysql-connector-java-5.1.46-bin.jar /usr/share/java/mysql-connector-java.jar
    
  10. create database

    mysql -u root -p
    
    CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'chenshi';
    CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY 'chenshi';
    CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY 'chenshi';
    CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY 'chenshi';
    CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON metastore.* TO 'hive'@'%' IDENTIFIED BY 'chenshi';
    CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY 'chenshi';
    CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY 'chenshi';
    CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY 'chenshi';
    CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'chenshi';
    
  11. set up database

    /opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm chenshi
    /opt/cloudera/cm/schema/scm_prepare_database.sh mysql amon amon chenshi
    /opt/cloudera/cm/schema/scm_prepare_database.sh mysql rman rman chenshi
    /opt/cloudera/cm/schema/scm_prepare_database.sh mysql hue hue chenshi
    /opt/cloudera/cm/schema/scm_prepare_database.sh mysql metastore hive chenshi
    /opt/cloudera/cm/schema/scm_prepare_database.sh mysql sentry sentry chenshi
    /opt/cloudera/cm/schema/scm_prepare_database.sh mysql nav nav chenshi
    /opt/cloudera/cm/schema/scm_prepare_database.sh mysql navms navms chenshi
    /opt/cloudera/cm/schema/scm_prepare_database.sh mysql oozie oozie chenshi
    
  12. set up database

    systemctl start cloudera-scm-server
    

    now, you can visit http://h1:7180 to go on.